package cn.tedu.spring.di;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserService {
  @Autowired //自动装配，注入 对象类型 和接口类型的数据
    private  UserDao userDao;
//    @Autowired
    public UserService(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public String toString() {
        return "UserService{" +
                "userDao=" + userDao +
                '}';
    }
//    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

}
